/*********************************************************************
 * Software License Agreement
 *
 * Copyright (C) 2010 Cross The Road Electronics.  All rights
 * reserved.
 *
 * Cross The Road Electronics (CTRE) licenses to you the right to 
 * use, copy, modify, merge, publish, distribute, sublicense, and/or 
 * sell copies of the Software ONLY when in use with CTRE's 2CAN 
 * Ethernet CAN Gateway.
 *
 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT
 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 * CROSS THE ROAD ELECTRONICS BE LIABLE FOR ANY INCIDENTAL, SPECIAL, 
 * INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
 *
********************************************************************/
#ifndef OS_Event__h_
#define OS_Event__h_

#include "OSAbstraction.h"

#if defined(OS_ABSTRACTION_VXWORKS)
class OS_Semaphore;
#endif

class OS_Event 
{
	public:
		OS_Event(const TCHAR * name, bool bManualReset);
		OS_Event();
		~OS_Event();
		
		void Signal();
		void Reset();
		bool IsSignaled();
		bool WaitUntilSignaled();
		bool WaitUntilSignaled(uint32_t timeout_ms);

		#ifdef OS_ABSTRACTION_VISUAL_STUDIO
			HANDLE m_hThread;
		#endif

		#if defined(OS_ABSTRACTION_VXWORKS)
			OS_Semaphore * sem;
			bool bSignaled;
			bool bManualReset;
		#endif

	private:
		OS_Event(const OS_Event & rhs) {}
};


#endif // OS_Event__h_


